<template>
	<div>
		<!--<div style="width: 100%;height: 20px;background-color: #ebedf0;"></div>-->
		<div style="display: block;width: 100%;text-align: left;margin-top: 50px;margin-bottom: 40px;">
			<Row style="text-align: left;margin-top: 40px;">
				<span style="border-left: 5px solid #517EDB;font-size: 16px;"></span>
				<span style="font-size: 16px;font-weight: 800;margin-left: 41px;">评价结果分制设置</span>
			</Row>
			<Row style="padding:35px 40px 0px 45px;">
				<Col span="24" style="text-align: left;">
				<span style="font-size: 14px;">设定分制：</span>
				<input type="text" oninput="value=value.replace(/[^\d]/g,'')" maxlength="10"  v-model="sort" value="sort" placeholder="请输入分制" style="text-align: center;width: 15%;position: relative;height: 30px;line-height: 30px;ime-mode: inactive;"></input>
				<Button @click="confirm=true" style="margin-left: 40px;" size="large" type="primary">确定</Button>
				<Modal title="提示" v-model="confirm" :closable="false"  class-name="vertical-center-modal" @on-ok="save" @on-cancel="cancelmodel">
					<p>确定设置为{{sort}}分制的吗？</p>
				</Modal>
				</Col>
			</Row>
		</div>
	</div>
</template>

<script>
	import { mapState } from 'vuex'
	import axios from 'axios'
	import api from "@/components/js/Apidomain.js"
	import { setlocalstorage, setsessionstorage, removesessionstorage, removelocalstorage } from "@/components/js/Localstorage.js"
	export default {
		data() {
			return {
				sort: "",
				confirm:false,
			}
		},
		computed: {

		},
		created() {
			this.init()
		},
		methods: {
			init() {
				var self = this;
				let url = api.apidomain + "/tqes//web/quaSettingParam/findOne"
				this.$http.post(url, {
						"settingCode": "GRADING_OF_EVALUATION_RESULTS"
					}).then(function(response) {
						if(response.data.success == true) {
							
							self.sort = response.data.data.settingValue
							console.log(self.sort)
							self.id = response.data.data.id
							//								self.$Message.success({
							//				                    content: response.data.msg,
							//				                    duration: 10,
							//				                    closable: true
							//		               			})
							//								self.init();
						} else if(response.data.success == false) {
							self.$Message.error({
								content: response.data.msg,
								duration: 10,
								closable: true
							});
						}
					})
					.catch(function(error) {
						self.$Message.error({
							content: '系统发生错误：错误码00277',
							duration: 10,
							closable: true
						});
					});

			},
			save: function() {

				var self = this;
				let url = api.apidomain + "/tqes/web/quaSettingParam/update"
				this.$http.post(url, {
						"id": this.id,
						"settingValue": this.sort
					}).then(function(response) {
						if(response.data.success == true) {
							console.log(response.data.data)
							self.$Message.success({
								content: response.data.msg,
								duration: 10,
								closable: true
							});
						} else if(response.data.success == false) {
							self.$Message.error({
								content: response.data.msg,
								duration: 10,
								closable: true
							});
						}
					})
					.catch(function(error) {
						self.$Message.error({
							content: '系统发生错误：错误码00277',
							duration: 10,
							closable: true
						});
					});
			},
			cancelmodel:function(){
				this.confirm=false
				window.location.reload()
			}

		},

	}
</script>

<style lang="less">
.vertical-center-modal{
        display: flex;
        align-items: center;
        justify-content: center;

        .ivu-modal{
            top: 0;
        }
    }
</style>